package cn.b.sky.mes.pp.model;

import java.text.NumberFormat;
import java.util.Date;

import cn.b.sky.common.model.ImeCommon;

/**
 * <strong>Title : POConfirmDetail.java<br>
 * </strong> <strong>Package : cn.b.sky.mes.pp.model<br>
 * </strong> <strong>Description : </strong>报工明细实体<br>
 * <strong>Create on : 2015年10月9日 下午2:04:26<br>
 * </strong>
 * <p>
 * 
 * @author dapeng.li<br>
 * @version <strong>v1.0.0</strong><br>
 * <br>
 *          <strong>修改历史:</strong><br>
 *          修改人 | 修改日期 | 修改描述<br>
 *          -------------------------------------------<br>
 * <br>
 * <br>
 */
public class ProductionConfirmDetail extends ImeCommon {
  /**
   * ID:number(19) <Primary Key>
   */
  private Long id;

  /**
   * 生产订单编号:nvarchar
   */
  private String productionOrderNum;

  /**
   * 新增订单类型字段
   */
  private String orderTypeCode;

  /**
   * 订单类型描述
   */
  private String orderTypeText;

  /**
   * 生产批次:nvarchar(40)
   */
  private String productionLotNum;

  /**
   * nVARCHAR2(20) 物料编号
   */
  private String materialCode;

  /**
   * nVARCHAR2(20) 物料描述
   */
  private String materialText;

  /**
   * 工艺工序ID:number(19)
   */
  private Long processOperationId;

  /**
   * 工序编号:nvarchar2(20)
   */
  private String operationCode;

  /**
   * 不良率：float
   */

  private String failureRate;

  /**
   * 数量
   */
  private double quantity;

  /**
   * 完工数量:number(19,3)
   */
  private Double completedQuantity;

  /**
   * 报废数量:number(19,3)
   */
  private Double scrappedQuantity;

  /**
   * 返修数量:number(19,3)
   */
  private Double repairQuantity;

  /**
   * 计划数量
   */
  private Float plannedQuantity;

  /**
   * 报工人:varchar2(40)
   */
  private String confirmUser;

  /**
   * 报工时间:date(0)
   */
  private Date confirmDateTime;

  /**
   * nVARCHAR2(20) 工作中心编号
   */
  private String workCenterCode;

  /**
   * nVARCHAR2(20) 工作中心描述
   */
  private String workCenterText;

  /**
   * nVARCHAR2(20) 作业单元编号
   */
  private String workUnitCode;

  /**
   * nVARCHAR2(20) 作业单元编号
   */
  private String workUnitText;

  /**
   * 生产管理号
   */
  private String productionControlNum;

  /**
   * 客户
   */
  private String customer;

  /**
   * 客户订单
   */
  private String customerOrder;

  /**
   * 优先级
   */
  private Integer priority;

  /**
   * @return defectiveRate
   */
  public Double getDefectiveRate() {
    return completedQuantity / (scrappedQuantity + completedQuantity);
  }

  /**
   * @return id
   */
  public Long getId() {
    return id;
  }

  /**
   * @return productionLotNum
   */
  public String getProductionLotNum() {
    return productionLotNum;
  }

  /**
   * @param productionLotNum
   *            要设置的 productionLotNum
   */
  public void setProductionLotNum(String productionLotNum) {
    this.productionLotNum = productionLotNum;
  }

  /**
   * @return materialCode
   */
  public String getMaterialCode() {
    return materialCode;
  }

  /**
   * @param materialCode
   *            要设置的 materialCode
   */
  public void setMaterialCode(String materialCode) {
    this.materialCode = materialCode;
  }

  /**
   * @return materialText
   */
  public String getMaterialText() {
    return materialText;
  }

  /**
   * @param materialText
   *            要设置的 materialText
   */
  public void setMaterialText(String materialText) {
    this.materialText = materialText;
  }

  /**
   * @param id
   *            要设置的 id
   */
  public void setId(Long id) {
    this.id = id;
  }

  /**
   * @return processOperationId
   */
  public Long getProcessOperationId() {
    return processOperationId;
  }

  /**
   * @param processOperationId
   *            要设置的 processOperationId
   */
  public void setProcessOperationId(Long processOperationId) {
    this.processOperationId = processOperationId;
  }

  /**
   * @return operationCode
   */
  public String getOperationCode() {
    return operationCode;
  }

  /**
   * @param operationCode
   *            要设置的 operationCode
   */
  public void setOperationCode(String operationCode) {
    this.operationCode = operationCode;
  }

  public double getQuantity() {
    return quantity;
  }

  public void setQuantity(double quantity) {
    this.quantity = quantity;
  }

  /**
   * @return completedQuantity
   */
  public Double getCompletedQuantity() {
    return completedQuantity;
  }

  /**
   * @param completedQuantity
   *            要设置的 completedQuantity
   */
  public void setCompletedQuantity(Double completedQuantity) {
    this.completedQuantity = completedQuantity;
  }

  /**
   * @return scrappedQuantity
   */
  public Double getScrappedQuantity() {
    return scrappedQuantity;
  }

  /**
   * @param scrappedQuantity
   *            要设置的 scrappedQuantity
   */
  public void setScrappedQuantity(Double scrappedQuantity) {
    this.scrappedQuantity = scrappedQuantity;
  }

  /**
   * @return repairQuantity
   */
  public Double getRepairQuantity() {
    return repairQuantity;
  }

  /**
   * @param repairQuantity
   *            要设置的 repairQuantity
   */
  public void setRepairQuantity(Double repairQuantity) {
    this.repairQuantity = repairQuantity;
  }

  public Float getPlannedQuantity() {
    return plannedQuantity;
  }

  public void setPlannedQuantity(Float plannedQuantity) {
    this.plannedQuantity = plannedQuantity;
  }

  /**
   * @return confirmUser
   */
  public String getConfirmUser() {
    return confirmUser;
  }

  /**
   * @param confirmUser
   *            要设置的 confirmUser
   */
  public void setConfirmUser(String confirmUser) {
    this.confirmUser = confirmUser;
  }

  /**
   * @return confirmDateTime
   */
  public Date getConfirmDateTime() {
    return confirmDateTime;
  }

  /**
   * @param confirmDateTime
   *            要设置的 confirmDateTime
   */
  public void setConfirmDateTime(Date confirmDateTime) {
    this.confirmDateTime = confirmDateTime;
  }

  /**
   * @return workCenterCode
   */
  public String getWorkCenterCode() {
    return workCenterCode;
  }

  /**
   * @param workCenterCode
   *            要设置的 workCenterCode
   */
  public void setWorkCenterCode(String workCenterCode) {
    this.workCenterCode = workCenterCode;
  }

  /**
   * @return workUnitCode
   */
  public String getWorkUnitCode() {
    return workUnitCode;
  }

  /**
   * @param workUnitCode
   *            要设置的 workUnitCode
   */
  public void setWorkUnitCode(String workUnitCode) {
    this.workUnitCode = workUnitCode;
  }

  /**
   * @return productionOrderNum
   */
  public String getProductionOrderNum() {
    return productionOrderNum;
  }

  public void setProductionOrderNum(String productionOrderNum) {
    this.productionOrderNum = productionOrderNum;
  }

  /**
   * @return failureRate
   */
  public String getFailureRate() {
    if ((this.completedQuantity == null || this.scrappedQuantity == null)
        || (this.completedQuantity + this.scrappedQuantity == 0)) {
      return "";
    }
    failureRate = NumberFormat.getPercentInstance().format(
        this.scrappedQuantity / (this.completedQuantity + this.scrappedQuantity));
    return failureRate;
  }

  /**
   * @param failureRate
   *            要设置的 failureRate
   */
  public void setFailureRate(String failureRate) {
    this.failureRate = failureRate;
  }

  /**
   * @return orderTypeCode
   */
  public String getOrderTypeCode() {
    return orderTypeCode;
  }

  /**
   * @param orderTypeCode
   *            要设置的 orderTypeCode
   */
  public void setOrderTypeCode(String orderTypeCode) {
    this.orderTypeCode = orderTypeCode;
  }

  /**
   * @return orderTypeText
   */
  public String getOrderTypeText() {
    return orderTypeText;
  }

  /**
   * @param orderTypeText
   *            要设置的 orderTypeText
   */
  public void setOrderTypeText(String orderTypeText) {
    this.orderTypeText = orderTypeText;
  }

  public String getWorkCenterText() {
    return workCenterText;
  }

  public void setWorkCenterText(String workCenterText) {
    this.workCenterText = workCenterText;
  }

  public String getWorkUnitText() {
    return workUnitText;
  }

  public void setWorkUnitText(String workUnitText) {
    this.workUnitText = workUnitText;
  }

  public String getProductionControlNum() {
    return productionControlNum;
  }

  public void setProductionControlNum(String productionControlNum) {
    this.productionControlNum = productionControlNum;
  }

  public String getCustomer() {
    return customer;
  }

  public void setCustomer(String customer) {
    this.customer = customer;
  }

  public String getCustomerOrder() {
    return customerOrder;
  }

  public void setCustomerOrder(String customerOrder) {
    this.customerOrder = customerOrder;
  }

  public Integer getPriority() {
    return priority;
  }

  public void setPriority(Integer priority) {
    this.priority = priority;
  }

}
